/*
 * @Description: 
 * @Author: zhihong deng
 * @Date: 2021-05-19 23:51:28
 * @LastEditors: zhihong deng
 * @LastEditTime: 2021-07-06 12:36:28
 */
const Koa = require('koa')
const app = new Koa()
const port = 3000
const respDurationMiddleware = require('./middleware/koa_response_duration')
const respHeaderMiddleware = require('./middleware/koa_response_header')
const respDataMiddleware = require('./middleware/koa_response_data')
app.use(respDurationMiddleware)
app.use(respHeaderMiddleware)
app.use(respDataMiddleware)
app.listen(port,() => {
    console.log(`端口运行在 http://localhost:${port}`);
})

const webSocketService = require('./service/web_socket_service')
// 开启服务端的监听，监听客户端的连接
// 当某一个客户端连接成功之后，就会对这个客户端进行message事件的监听
webSocketService.listen()